package com.oa.ylms.apps.actions.limit;

import java.util.List;

import net.sf.json.JSONArray;

import com.oa.ylms.apps.actions.BasicAction;
import com.oa.ylms.apps.business.limit.impl.LimitInfoServiceImpl;
import com.oa.ylms.apps.entity.archives.StaffInfoValue;
import com.oa.ylms.apps.entity.limit.LimitInfoValue;

@SuppressWarnings("serial")
public class LimitInfoAction extends BasicAction {
	
	LimitInfoServiceImpl service;
	List<LimitInfoValue> list;
	
	String parentId;
	String str;

	// Action method
	
	public String execute() throws Exception {
		staffInfo = (StaffInfoValue)session.get("login_staffInfo");
		if(staffInfo != null )
		list = service.queryByParentId(parentId,staffInfo.getArchiveInfo().getPostInfo().getPostId());
		JSONArray obj = JSONArray.fromObject(list);
		this.str = obj.toString();
		response.setContentType("text/html; charset=UTF-8");
		response.setHeader("Cache-Control", "no-cache");
		response.getWriter().print(str);
		return null;
	}

	// Action property accessors
	
	public String getStr() {
		return str;
	}

	public void setStr(String str) {
		this.str = str;
	}

	public LimitInfoServiceImpl getService() {
		return service;
	}

	public void setService(LimitInfoServiceImpl service) {
		this.service = service;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public List<LimitInfoValue> getList() {
		return list;
	}

	public void setList(List<LimitInfoValue> list) {
		this.list = list;
	}
	
}
